package com.kk.springboot_001.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseMessage<T> {
    private Integer code;
    private String message;
    private T data;


    public static <T> ResponseMessage success(T data){
        ResponseMessage<T> responseMessage = new ResponseMessage<>();
        responseMessage.setCode(HttpStatus.OK.value()); //200
        responseMessage.setMessage("success");
        responseMessage.setData(data);
        return responseMessage;
    }

}
